package rjgc.mall.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import rjgc.mall.entity.vo.BigType;
import rjgc.mall.mapper.VegetablesTypeMapper;
import rjgc.mall.service.VegetablesTypeService;

import java.util.List;

@Service
public class VegetablesTypeServiceImpl implements VegetablesTypeService {
    @Autowired
    private VegetablesTypeMapper vegetablesTypeMapper;
    @Override
    public List<BigType> getAllType() {
        List<BigType> bigTypes = vegetablesTypeMapper.getAllType();
        for(BigType b:bigTypes){
            b.setChildren(vegetablesTypeMapper.getType(b.getId()));
        }
        return bigTypes;
    }
}
